<template>
	<div class="qualityquery_high">
		<!--成绩报告页面-->
		<Row style="margin-top: 20px;margin-bottom: 20px;">
	        <Col span="8">
	        	<span>学年：</span>
				<Select v-model="studyYearSelect" style="width:150px" @on-change="studyYearSelectChange">
			        <Option v-for="item in studyYearList" :value="item.value" :key="item.value">{{ item.label }}</Option>
			    </Select>
	        </Col>
	    </Row>
	    <div style="width: 100%;height: 20px;background-color: #ebedf0;"></div>
	    <Row style="text-align: left;margin-top: 41px;">
			<span style="border-left: 5px solid #517EDB;font-size: 14px;"></span>
			<span style="font-size: 18px;margin-left: 10px;">考试列表</span>
		</Row >
	    <!--<Row >
	        <Col span="10" style="text-align: left;margin-top:15px;font-size: 18px;">
	        	<span>考试列表</span>
	        </Col> 
	    </Row>-->
	    <div style="padding: 0px 20px 20px 20px;">
	        	<Row v-for="item in list" :key="item.performanceId" style="margin-top:15px;text-align: left;">   			
			        <Col span="24" >
			        	<Card>
					        <Row >   			
			        			<Col span="24">
						        	{{item.analysisName}}
			        			</Col>			        
							</Row>
							<Row style="margin-top:10px;text-align: left;">   			
			        			<Col span="6">
						        	入学年份：{{item.enrolYear}}
			        			</Col>
			        			<Col span="4">
						        	年段：{{item.gradeName}}
			        			</Col>
			        			<Col span="6">
						        	学年：{{item.schoolYear}}
			        			</Col>
			        			<!--<Col span="4">
						        	学期：上学期
			        			</Col>-->
			        			<Col span="6">
						        	时间：{{item.analysisTime}}
			        			</Col>
			        			<Col span="2">
			        				<Tooltip content="查看详细数据" theme="light">
						        		<Button type="ghost" shape="circle" icon="ios-keypad" @click="lookdetail(item.analysisId,item.gradeName,item.schoolYear,item.analysisTime,item.analysisName)"></Button>
						        	</Tooltip>
						        	<!--<Tooltip content="删除此数据" theme="light">
						        		<Button type="ghost" shape="circle" icon="trash-a" @click="deldata(item.performanceId)"></Button>
						        	</Tooltip>-->
			        			</Col>
							</Row>
					    </Card>
			        </Col>	
				</Row> 
		    </div>
		    
		    <Page style="text-align: center;margin-top:15px;margin-bottom: 15px;" :current="current" :total="recordCount" @on-change="pageChange"/>
	</div>
</template>

<script>
	import { setsessionstorage,getsessionstorage } from '@/components/js/Localstorage'
	import api from "@/components/js/Apidomain.js"
	export default{
		data(){
			return{
				
				studyYearSelect:"",
				
				current:1,					//页码
				recordCount:0,				//总条数
				
				studyYearList:[
//					{value: '1',label: '2017'},
//					{value: '2',label: '2018'},
//					{value: '3',label: '2019'}
				],
				
				list:[],
			}
		},
		created(){
			this.getStudyYearList()
		},
		methods:{
			//获取学年选择列表
           	getStudyYearList:function(){
           		var self = this;
           		let roleId = getsessionstorage("roleid");
            	let url = api.apidomain+'/tqes/web/squaAnalysis/getPCQuerySchoolYearSelect';
            	this.$http.post(url,{"roleId":roleId}).then(function(response) {
					if(response.data.success == true){
//						////console.log(response.data.data)
						self.studyYearList = response.data.data
						if(self.studyYearList.length != 0){
							self.studyYearSelect = self.studyYearList[0].value;
							self.getcalculationlist()
						}
		            }else if(response.data.success == false){
		            		self.$Message.error({
								content: response.data.msg,
								duration: 10,
								closable: true
							});	
		            	}
					})
					.catch(function(error) {
						self.$Message.error({
							content: '系统发生错误：错误码00273',
							duration: 10,
							closable: true
						});
					});
           	},
           	studyYearSelectChange:function(){
           		this.current = 1;
           		this.getcalculationlist()
           	},
           	pageChange:function(value){
        		this.current = value;
        		this.getcalculationlist()
        	},
           	getcalculationlist:function(){
           		
//         		this.listshow = true;
           		let sessionroleid = getsessionstorage('roleid');
           		var self = this;
       			var senddata = {
           			roleId: sessionroleid,
					current:this.current,						//当前页数
					pageSize:"10",						//每页显示行数
					schoolYearStart:this.studyYearSelect,					//界别（往届）
           		}
            	let url = api.apidomain+'/tqes/web/squaAnalysis/getAnalysisListByPage';
            	this.$http.post(url, senddata).then(function(response) {
					if(response.data.success == true){
						
//						//console.log(response.data.data.items)
						self.list = response.data.data.items
						self.recordCount = response.data.data.recordCount
						if(self.list.length == 0){
							self.textinfo = "查询信息为空"
						}
//						self.listshow = false;
		            }else if(response.data.success == false){
		            		self.$Message.error({
								content: response.data.msg,
								duration: 10,
								closable: true
							});	
//		            		self.listshow = false;
		            	}
					})
					.catch(function(error) {
						self.$Message.error({
							content: '系统发生错误：错误码00274',
							duration: 10,
							closable: true
						});
//						self.listshow = false;
					});
           	},
           	lookdetail:function(analysisId,gradeName,schoolYear,analysisTime,analysisName){
				//保存评价id到sessionstorage
				setsessionstorage('quality_analysisId',analysisId);
				setsessionstorage('quality_enrolYear',this.studyYearSelect);
				setsessionstorage('quality_gradeName',gradeName);
				setsessionstorage('quality_schoolYear',schoolYear);
				setsessionstorage('quality_analysisTime',analysisTime);
				setsessionstorage('quality_analysisName',analysisName);
				
        		this.$router.push({name:'studentQueryDetailed'})
        	},
		}
	}
</script>

<style lang="css" scoped>
	.qualityquery_high >>> .ivu-card-body{
		padding: 12px 15px;
		background-color: #f7f7f7;
	}
</style>